'use strict'
// Template version: 1.3.1
// see http://vuejs-templates.github.io/webpack for documentation.

const path = require('path')
//导入proxy
var proxy = require('http-proxy-middleware')
    
//context可以是单个字符串，也可以是多个字符串数组，分别对应你需要代理的api,星号（*）表示匹配当前路径下面的所有api
const context = [`/*`]

module.exports = {
  dev: {

    // Paths
    assetsSubDirectory: 'static',
    assetsPublicPath: '/',
    proxyTable: {
      '/erm': {
        // target: 'http://10.10.6.202:8032/erm',
        target: 'http://localhost:3000/erm',
        changeOrigin: true,
        pathRewrite: {
            '^/erm': ''
        },
      },
      '/login': {
        // target: 'http://10.10.6.202:8032/erm',
        target: 'http://localhost:3000/login',
        changeOrigin: true,
        pathRewrite: {
            '^/login': ''
        },
      },
      '/web': {
        // target: 'http://10.10.6.202:8032/erm',
        target: 'http://localhost:3000/web',
        changeOrigin: true,
        pathRewrite: {
            '^/web': ''
        },
      },
      '/face': {
        // target: 'http://10.10.6.202:8032/erm',
        target: 'http://localhost:3000/face',
        changeOrigin: true,
        pathRewrite: {
            '^/face': ''
        },
      },
      '/addTagEE': {
        // target: 'http://10.10.6.202:8032/erm',
        target: 'http://localhost:3000/addTagEE',
        changeOrigin: true,
        pathRewrite: {
            '^/addTagEE': ''
        },
      },
      '/getTagEE': {
        // target: 'http://10.10.6.202:8032/erm',
        target: 'http://localhost:3000/getTagEE',
        changeOrigin: true,
        pathRewrite: {
            '^/getTagEE': ''
        },
      },
      '/getEmployeeWorkLoadList':{
	      	target: 'http://localhost:3000/getEmployeeWorkLoadList',
	        changeOrigin: true,
	        pathRewrite: {
	            '^/getEmployeeWorkLoadList': ''
	        },
      },
      '/getEmployeeWorkLoadDetail':{
        target: 'http://localhost:3000/getEmployeeWorkLoadDetail',
        changeOrigin: true,
        pathRewrite: {
            '^/getEmployeeWorkLoadDetail': ''
        },
      },
      '/deleteTagEE': {
        // target: 'http://10.10.6.202:8032/erm',
        target: 'http://localhost:3000/deleteTagEE',
        changeOrigin: true,
        pathRewrite: {
            '^/deleteTagEE': ''
        },
      },
      '/entity': {
        // target: 'http://10.10.6.202:8032/erm',
        target: 'http://localhost:3000/entity',
        changeOrigin: true,
        pathRewrite: {
            '^/entity': ''
        },
      },
      '/app': {
        // target: 'http://10.10.6.202:8032/erm',
        target: 'http://localhost:3000/app',
        changeOrigin: true,
        pathRewrite: {
            '^/app': ''
        },
      },
      '/getVisiorsFlowrate':{
	      	target: 'http://localhost:3000/getVisiorsFlowrate',
	        changeOrigin: true,
	        pathRewrite: {
	            '^/getVisiorsFlowrate': ''
	        },
      },
      '/user':{
        target: 'http://localhost:3000/user',
        changeOrigin: true,
        pathRewrite: {
            '^/user': ''
        },
      },

      '/dingtalk':{
        target: 'http://localhost:3000/dingtalk',
        changeOrigin: true,
        pathRewrite: {
            '^/dingtalk': ''
        },
      },
    },

    // Various Dev Server settings
    host: 'localhost', // can be overwritten by process.env.HOST
    port: 8081, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
    autoOpenBrowser: true,
    errorOverlay: true,
    notifyOnErrors: true,
    poll: 1000, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-

    // proxy: [
    //   {
    //        context: context,
    //        target: 'http://10.10.6.202:8032',
    //        changeOrigin: true,
    //        secure: false
    //  }
    // ],
    /**
     * Source Maps
     */

    // https://webpack.js.org/configuration/devtool/#development
    devtool: 'cheap-module-eval-source-map',

    // If you have problems debugging vue-files in devtools,
    // set this to false - it *may* help
    // https://vue-loader.vuejs.org/en/options.html#cachebusting
    cacheBusting: true,

    cssSourceMap: true
  },

  build: {
    // Template for index.html
    index: path.resolve(__dirname, '../dist/index.html'),

    // Paths
    assetsRoot: path.resolve(__dirname, '../dist'),
    assetsSubDirectory: 'static',
    assetsPublicPath: './',

    /**
     * Source Maps
     */

    productionSourceMap: false,
    // https://webpack.js.org/configuration/devtool/#production
    devtool: '#source-map',

    // Gzip off by default as many popular static hosts such as
    // Surge or Netlify already gzip all static assets for you.
    // Before setting to `true`, make sure to:
    // npm install --save-dev compression-webpack-plugin
    productionGzip: true,
    productionGzipExtensions: ['js', 'css'],

    // Run the build command with an extra argument to
    // View the bundle analyzer report after build finishes:
    // `npm run build --report`
    // Set to `true` or `false` to always turn it on or off
    bundleAnalyzerReport: process.env.npm_config_report
  }
}
